<template>
  <a-select class="f-input" placeholder="请选择" @change="handleChange" :value="_value" allowClear>
    <a-select-option :value="item.dictValue" v-for="(item, idx) in dataSource" :key="idx"> {{ item.dictLabel }} </a-select-option>
  </a-select>
</template>

<script lang="ts">
import { Vue, Component, Model } from "vue-property-decorator";
import { Select } from "ant-design-vue";

@Component({
  name: "FlowType",
  components: {
    ASelect: Select,
    ASelectOption: Select.Option
  }
})
export default class FlowType extends Vue {
  @Model("input") value!: any;
  private get _value() {
    const _return = this.value;
    return _return ? _return : undefined;
  }

  private dataSource: any = [];

  private created() {
    this.getSystemDict();
  }

  private async getSystemDict() {
    const res = await this.$api.SystemDict("sys_process_type");
    if (res && res.code === 200) {
      this.dataSource = res.data;
    }
  }

  private handleChange(value: string) {
    this.$emit("input", value);
  }
}
</script>
